package DAO;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
/**
 * 联合查询表
 * @author MacBook
 *
 */
public class user_bookDAO {
	//获取借书列表
	public static List user_bookList(Session session,int userid){
		String hql = "select new Model.user_book(b.bookid,b.bookname,b.publisher,bo.date) from book b,borrow bo where bo.user_id = ? and bo.book_id = b.bookid";
		Query query =session.createQuery(hql);
		query.setParameter(0, userid);
		List list = query.list();
		if(list.size() == 0)
			return null;
		return list;
	}
}
